var utilities={};
// $apply检测
utilities.safeApply=function(scope,fn){var phase=scope.$root.$$phase;"$apply"==phase||"$digest"==phase?fn&&"function"==typeof fn&&fn():scope.$apply(fn)},
//数组去重
utilities.unique=function(arr){for(var elem,result=[],hash={},i=0;null!=(elem=arr[i]);i++)hash[elem]||(result.push(elem),hash[elem]=!0);return result};